package com.finalist.service.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.finalist.Page;
import com.finalist.Pageable;
import com.finalist.dao.CombinedCommodityDao;
import com.finalist.dao.ProductDao;
import com.finalist.entity.Attribute;
import com.finalist.entity.Brand;
import com.finalist.entity.CombinedCommodity;
import com.finalist.entity.Product;
import com.finalist.entity.ProductCategory;
import com.finalist.entity.Promotion;
import com.finalist.entity.Tag;
import com.finalist.entity.Product.OrderType;
import com.finalist.service.CombinedCommodityService;

@Service("combinedCommodityServiceImpl")
public class CombinedCommodityServiceImpl extends BaseServiceImpl<CombinedCommodity, Long> implements CombinedCommodityService {

	@Resource(name = "combinedCommodityDaoImpl")
	private CombinedCommodityDao combinedCommodityDao;
	
	@Resource(name = "combinedCommodityDaoImpl")
	public void setBaseDao(CombinedCommodityDao combinedCommodityDao) {
		super.setBaseDao(combinedCommodityDao);
	}

	@Transactional(readOnly = true)
	public Page<CombinedCommodity> findPage(ProductCategory productCategory, Brand brand, Promotion promotion, List<Tag> tags, Map<Attribute, String> attributeValue, BigDecimal startPrice, BigDecimal endPrice, Boolean isMarketable, Boolean isList, Boolean isTop, Boolean isGift, Boolean isOutOfStock, Boolean isStockAlert, OrderType orderType, Pageable pageable) {
		return combinedCommodityDao.findPage(productCategory, brand, promotion, tags, attributeValue, startPrice, endPrice, isMarketable, isList, isTop, isGift, isOutOfStock, isStockAlert, orderType, pageable);
	}

	@Override
	public List<CombinedCommodity> findByType(CombinedCommodity combinedCommodity) {
		return combinedCommodityDao.findByType(combinedCommodity);
	}
}
